<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<th:block th:insert="~{include :: header('用户白名单')}"/>
<body>
<div class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-prove-white-add">
            <input id="id" name="id" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label" for="prove">QQ：</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        <input class="form-control" id="prove" name="prove" placeholder="要加入白名单的QQ账号"
                               type="number">
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
<th:block th:insert="~{include :: footer}"/>
<script type="text/javascript">
    const prefix = ctx + "config/bot/white/prove";

    $.validator.addMethod("qq", function (value, element, param) {
        var qqPattern = /^[1-9][0-9]{4,10}$/;
        return new RegExp(qqPattern).test(value);
    }, "请输入5-11位的QQ账号");

    $("#form-prove-white-add").validate({
        rules: {
            prove: {
                required: true,
                qq: true,
            }
        },
        messages: {
            prove: {
                required: "请输入正确的QQ账号",
            }
        },
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/add", $('#form-prove-white-add').serialize());
        }
    }


</script>
</body>
</html>